@extends('admin.index')
@section('content')
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>库存信息</title>  
    <link rel="stylesheet" href="{{asset ('admins/css/pintuer.css ')}}">
    <link rel="stylesheet" href="{{asset ('admins/css/admin.css ')}}">
    <script src="{{asset ('admins/js/jquery.js ')}}"></script>
    <script src="{{asset ('admins/js/pintuer.js ')}}"></script>  

    <body>      
    <form style='display:none;' action='{{url("admin/sku")}}' method='post' name='myform'>
        <input type='hidden' name='_token' value='{{ csrf_token() }}'>
        <input type='hidden' name='_method' value='DELETE'>
    </form>
    <form action="{{url('admin/sku')}}"  >
    <div class="panel admin-panel">
      <div class="panel-head"><strong class="icon-reorder"> 库存列表</strong></div>
      <div>    
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <input type="submit" class="button border-main icon-search" value="搜索">
      </div>
      <div>
          @if (session('msg'))
              <div class="alert alert-success">
                  {{ session('msg') }}
              </div>
          @endif
      </div>             
      <table class="table table-hover text-center">
        <tr>
          <th width="10%">ID</th>
          <th width="10%">商品</th>
          <th width="20%">商品名</th>
          <th width="15%">型号</th>
          <th width="10%">颜色</th>
          <th width='8%'>数量</td>
          <th width="8%">现价</th>
          <th width="20%">操作</th>
        </tr>
        @foreach($list as $k=>$v) 
          <td width='10%'>{{$v->id}}</td>
          <td width="10%">{{$v->good}}</td>
          <td width="10%">{{$v->title}}</td>
          <td width="10%">{{$v->attr}}</td>
          <td width='10%'>{{$v->color}}</td>
          <td width="10%">{{$v->stock}}</td>
          <td>{{$v->price}}</td>
          <td>
            <a class="button border-main" href="{{url('admin/sku/').'/'.$v->id}}/edit"><span class="icon-edit"></span> 修改</a>
            <a class="button border-red" href="javascript:doDel({{ $v->id }})" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 删除</a>
          </td>  
        </tr>
        @endforeach
      </table>
    </div>
    </form>
    <br>

{{ $list-> appends($where)->links() }}
    
    <script type="text/javascript">
      function doDel(id)
      {
        if(confirm("你确定要删除吗？")){
          var form = document.myform;
          form.action = '/admin/sku/'+id;
          form.submit();
        }
      }
    </script>
    </body>
    @stop